<?php 
require_once 'GuestAPI.php';
$guestAPI = new GuestAPI();
//print_r($guestAPI->getPublicTimeLine());
//print_r($guestAPI->getPublicTimeLineUpdate());
//print_r($guestAPI->getUserInfo("michalliu"));
//print_r($guestAPI->getUsersInfo(array("michalliu","mmplayer")));
//print_r($guestAPI->getHotTopic(10));
//print_r($guestAPI->getHotTopic(array("分享照片","分享音乐"),10));
//print_r($guestAPI->getCityBroadcast("海南",10));
//print_r($guestAPI->getCityBroadcastUpdate("海南"));
if (isset($_GET["m"])&&$_GET["m"]=="getpublicmessage")
{
	print_r($guestAPI->getCityBroadcastUpdate("海南"));
	exit();
}
require_once MB_APP_DIR   . '/global.class.php';
$logger = new MBLog($mbConfig["log_path"], "test", false);
MBGlobal::setLogger($logger);
$userlistA = MBGlobal::getAdminRecomm()->showHainanUser(0, 10, 1);	//海南牛人
$userlistB = MBGlobal::getAdminRecomm()->showRecNewUser(0, 10, 1);	//最新推荐
$userlistC = MBGlobal::getAdminRecomm()->showInterestUser(0, 10, 1);//最受关注用户
$hotTopic=MBGlobal::getAdminRecomm()->showHotTopic(0,10,1);
if(!empty($hotTopic["list"])){
$hotTopicNamesListArr=array();
foreach($hotTopic["list"] as $h)
{
	$hotTopicNamesListArr[] = $h["text"];
}
}
$hotTopics=$guestAPI->getHotTopic($hotTopicNamesListArr,10);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style/css/hn_pub.css" rel="stylesheet" type="text/css" />
<link href="style/css/hn_login.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/third-party/jquery/jquery-1.4.4.min.js"></script>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>南海网</title>
</head>
<body style="background-color:#88C6EB;">
<center>
<!--代码从此处开始-->
<div class="lbj01">
<div class="lbj02"><div class="h96"></div>
<div class="lbj04 w954">
<table width="950" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="top" width="703">
    <div class="f1"><img src="style/images/login/lbj28.jpg" width="703" height="200" alt="" /></div>
    <div class="lbj06 w703 h37">
    <div class="vm l37 fl ml38 f12 llink0001">
    <?php
    $hottopiclist = MBGlobal::getAdminRecomm()->showHotTalking(0, 10, 1);
	$hottopicstr="";
	$link="index.php?m=topic&k=";
	if($hottopiclist["list"])
	{foreach($hottopiclist["list"] as $i=>$t)
		{$hottopicstr.=" <a href=\"".$link.$t["text"]."\" target=\"_blank\" class=\"llink0001\">".$t["text"]."</a> ";}
	}
    ?>
    <b>正在热议：</b><?php echo($hottopicstr);?>
    </div>
    </div>
    <div class="sp8"></div>
    <div class="lbk01 w690">
    <div class="lbj07 w690 h36"><div class="sp6"></div>
   <div class="fl ml30"> <style>
/*滑动门样式*/

.tb_{ height:30px;
}
.tb_ ul {
height:30px;
}
.tb_ li {
float:left;
height:30px;
cursor:pointer; 
}

.normaltab{
background:none;
width:90px; 
text-align:center;
vertical-align:middle;line-height:30px; color:#0c338c; font-size:14px;
}

.hovertab {
background:url(style/images/login/lbj2.jpg) no-repeat center top; 
width:90px;
text-align:center;
line-height:30px;
vertical-align:middle; font-weight:bold; color:#0c338c; font-size:14px;
}
</style>
<script type="text/javascript" language="JavaScript">
function g2(o){return document.getElementById(o);}
function HoverLi2(n){
for(var i=1;i<=2;i++){g2('tab_'+i).className='normaltab';g2('tabc_0'+i).className='undis';}g2('tabc_0'+n).className='dis';g2('tab_'+n).className='hovertab';
}
</script>
<div class="tb_" id="tb_"><ul style="margin:0px; padding:0px;">
<li id="tab_1" class="hovertab fc" onmouseover="x:HoverLi2(1);">海南牛人</li>
<li id="tab_2" class="normaltab" onmouseover="i:HoverLi2(2);">最新推荐</li>
</ul>
</div>
</div>
    </div>
<?php
function formatUserList($arr)
{	if($arr["count"]==0){return array();};
	foreach($arr["list"] as $i => $u) 
	{ try
	  {
	  $g=new GuestAPI();
	  $user=$g->getUserInfo($u["uname"]);
	  }
	  catch(Exception $e)
	  {
	   $user["nick"]="拉取信息失败";
	   $user["head"]="";
	  }
	   $arr["list"][$i]["nick"]=$user["nick"];
	   $arr["list"][$i]["head"]=($user["head"]==""?"style/images/default_head_small.png":$user["head"]."/50");
	}
	
	return $arr;
}
function getUserList($arr)
{
$tempstr="";
$arr=formatUserList($arr);
if (!$arr["list"]){return "";}
foreach($arr["list"] as $o)
{
$tempstr.="<li><div class=\"head\"><a href=\"index.php?m=guest&u=".$o["uname"]."\" target=\"_blank\"><img src=\"".$o["head"]."\"></a></div>";
$tempstr.="<div class=\"info\"><h3><a href=\"index.php?m=guest&u=".$o["uname"]."\" target=\"_blank\">".$o["nick"]."</a></h3>";
$tempstr.="<p>".$o["info"]."</p>";
$tempstr.="</div>";
$tempstr.="</li>";
}
return $tempstr;
}

function getUserList2($arr)
{	
	$tempstr="";
	$arr=formatUserList($arr);
	if (!isset($arr["list"])){return "";}
    foreach ($arr["list"] as $user)
	{
	  $tempstr.="<li title=\"".$user["nick"]."(@".$user["uname"].")\"><p><a href=\"index.php?m=guest&u=".$user["uname"]."\"><img src=\"".$user["head"]."\" alt=\"".$user["nick"]."(@".$user["uname"].")\"/></a><p><h3><a href=\"index.php?m=guest&u=".$user["uname"]."\">".$user["nick"]."</a></h3></li>";
	}
	return $tempstr;
}

?>
    <div class="deng_bg5">
<div class="sp12"></div>
<div class="dis" id="tabc_01">
<!--滑动门1-->
<div class="slidebox slideboxA">
	<a class="slideA" href="javascript:void(0)"></a>	
	<a class="slideB" href="javascript:void(0)"></a>
	<div class="slidewrap">
		<ul><?php echo(getUserList($userlistA));?></ul>
	</div>	
</div>


 </div> 
<div class="undis" id="tabc_02" style="overflow: hidden;">
<!--滑动门2-->
<div class="slidebox slideboxB">
	<a class="slideA" href="javascript:void(0)"></a>	
	<a class="slideB" href="javascript:void(0)"></a>
	<div class="slidewrap">
		<ul><?php echo(getUserList($userlistB));?></ul>
	</div>	
</div>
</div>
</div>
<script>
$(document).ready(function(){
	$("#searchBtn").click(function(){
		var key = $("#searchKey").val().trim();
		document.location = "/index.php?m=searchall&k="+key;
	});
	var slider=function(o)
	{
		var bA=o.find(".slideA"),bB=o.find(".slideB"),slist=o.find("ul"),sli=slist.find("li");
		function init()
		{	var _w=sli.width()+10,w=sli.size()*_w+10,issliding=false;
			slist.width(w);
			bB.attr("disabled","disabled");
			bA.click(function(){
				var x=parseInt(slist.css("left"),10);
				if((-x+4*_w)>=w){return false;}
				if(Math.round(x%_w)!=0){return false;}
				slist.animate({"left":parseInt(slist.css("left"),10)-_w},500,function(){
				bB.removeAttr("disabled");
				x=parseInt(slist.css("left"),10);
				if((-x+4*_w)>=w){bA.attr("disabled","disabled");}
				});
			});
			bB.click(function(){
				var x=parseInt(slist.css("left"),10);
				if(x>=0){return false;}
				if(Math.round(x%_w)!=0){return false;}
				slist.animate({"left":parseInt(slist.css("left"),10)+_w},500,function(){
				bA.removeAttr("disabled");
				x=parseInt(slist.css("left"),10);
				if(x>=0){bB.attr("disabled","disabled");}
				});
			});
		}
		init();
	}
	var s1=new slider($(".slideboxA"));
	var s2=new slider($(".slideboxB"));
});


</script>
<div class="sp5"></div>
<div class="lbj08 w690 h33">
<table width="690" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="top" width="466">
<div class="sp3"></div>
<div class="fl ml30">
<div class="lbj09 w90 h30">
<div class="vm l30 f14 fb fc" style="color:#0c338c;">热播海南</div>
</div>
</div>
</td>
<td align="center" valign="top" width="224">
<div class="sp6"></div>

<div class="lbj10 w216 h23">
<table width="216" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="top" width="188"><input type="text" id="searchKey" class="w180 f14" style="background:none; border:0px;" /></td>
    <td align="center" valign="top" width="28"><input type="button" id="searchBtn" class="w26 h23" style="background:none; border:0px;cursor:pointer;cursor:hand;" /></td>
  </tr>
</table>

</div>

</td>
  </tr>
</table>

</div>
<div class="sp10"></div>
<table width="690" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="top" width="73" style="background:url(style/images/login/lbj14.jpg) no-repeat center top; height:78px;">
    <div class="sp12"></div>
    <div class="fr mr12 f12 llink0003">此时</div>
    <div class="h22"></div>
    <div class="fr mr12 f12 llink0003">这周</div> 
    </td>
    <td align="center" valign="top" width="617">
    <?php
	$tempstr_current=$guestAPI->getHotPlayingHainan("day");
	$tempstr_curweek=$guestAPI->getHotPlayingHainan("week");
	?>
    <div class="sp9"></div>
    <div class="fl ml12 f18 fb llink0003"><?php echo($tempstr_current);?></div>
    <div class="sp19"></div>
    <div class="fl ml12 f12 fb llink0003"><?php echo($tempstr_curweek);?></div>
    </td>
  </tr>
</table>

    </div>
    <div class="sp7"></div>
    <div class="lbj11 w692 h43">
    <style>
/*滑动门样式*/

.tb2_{ height:33px;
}
.tb2_ ul {
height:33px;
}
.tb2_ li {
float:left;
height:33px;
cursor:pointer; 
}

.normaltab2{
background:none;
width:88px; 
text-align:center;
vertical-align:middle;line-height:33px; color:#2e69a4; font-size:14px;
}

.hovertab2 {
background:url(style/images/login/lbj5.jpg) no-repeat center top; 
width:88px;
text-align:center;
line-height:33px;
vertical-align:middle; font-weight:bold; color:#2e69a4; font-size:14px;
}

</style>

<div class="sp10"></div>
<div class="fl ml32"><div class="tb2_" id="tb2_">
<ul style="margin:0px; padding:0px;">
<li id="tab2_1" class="hovertab2 fc">正在微博</li>
</ul>
</div>
</div>
</div>
<div class="dis" id="tabc2_01">
<!--滑动门1-->
<?php 
print_r($guestAPI->getCityBroadcast("海南",10));
?>
</div>
<script>
$(document).ready(function(){
	var _this=$("#tabc2_01");
		_this.find(".tmessage").first().find("extra").hide();
		//setTimeout("loadNewMessage()",1000);
		loadNewMessage();
	function loadNewMessage()
	{	var _thisUL=_this.find("ul").first();
		var idA=_thisUL.find("li").first().attr("id");
		$.get("?m=getpublicmessage",{},function(d){
		d=d.replace(/<(\/){0,1}ul[\s\S]*?>/g,"");
		var o=$(d).prependTo(_this.find("ul").first()).hide();
			if(o.attr("id")!=idA)
			{o.slideDown("fast");
			 _thisUL.find("li").last().slideUp("fast",function(){$(this).remove();});
			}
			setTimeout(loadNewMessage,1000*3);
		});
	}
});
</script>  
    </td>
    <td align="center" valign="top" width="247">
    <div class="lbj05 w233 h272">
    <div class="h28"></div>
    <div class="f1"><a href="#" target="_blank"><img src="style/images/login/lbj22.jpg" width="196" height="51" alt="" /></a></div>
    <div class="sp17"></div>
    <div class="lbj03 w194 h31">
    <input type="text" name="ckeywords" id="ckeywords" value="阳光岛帐号可直接登录" style="color:#848484; border:0px; background:none; vertical-align:middle; line-height:29px;" onblur="if(this.value=='') {this.value='阳光岛帐号可直接登录';this.form.keywords.style.color='#848484'}" onclick="if(this.value=='阳光岛帐号可直接登录'){this.value='';this.form.keywords.style.color='#333'}" class="w192 h29" />
    </div> <div class="sp10"></div>
    <div class="lbj03 w194 h31">
    <input type="text" name="ckeywords" id="ckeywords" value="请输入密码" style="color:#848484; border:0px; background:none; vertical-align:middle; line-height:29px;" onblur="if(this.value=='') {this.value='请输入密码';this.form.keywords.style.color='#848484'}" onclick="if(this.value=='请输入密码'){this.value='';this.form.keywords.style.color='#333'}" class="w192 h29" />
    </div><div class="sp7"></div>
    <table width="194" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" valign="top"><input type="checkbox" /><span class="llink0003">下次自动登录</span></td>
    <td align="right" valign="top"><div class="sp3"></div><a href="#" target="_blank" class="llink1">找回密码</a></td>
  </tr>
</table>
<div class="sp12"></div>
<input type="image" src="style/images/login/lbj24.jpg" />
<div class="sp10"></div>
<div class="f12 llink2"><a href="index.php?m=login">使用腾讯微博帐号/QQ账号登录</a></div>
    </div><div class="sp7"></div>
    <div class="lbj12 w245 h32"><div class="sp7"></div>
    <div class="fl ml39 f12 fb">最受关注用户</div>
    </div>
    <div class="sp20"></div>
    <ul class="userlist"><?php echo(getUserList2($userlistC));?></ul>
    <div class="sp7"></div>
    <!--
    <div class="lbj14 w245 h31"><div class="sp4"></div>
    <div class="fl ml39 f12 fb">近期活跃用户</div>
    </div>
    <div class="sp20"></div>
       <?php
    $userlist2=array(
    array("name"=>'lengxiaohua',"nick"=>'冷笑话精选','head'=>'http://app.qlogo.cn/mbloghead/a1407d65cc66644423d0'),
    array("name"=>'parkyc0604',"nick"=>'秀伊','head'=>'http://app.qlogo.cn/mbloghead/b5a0af7c9fe59b0d7850'),
    array("name"=>'kissbaby1112',"nick"=>'亲宝','head'=>'http://app.qlogo.cn/mbloghead/87469cb5e768bcd00f46'),
    array("name"=>'taoshangyin',"nick"=>'淘上瘾','head'=>'http://app.qlogo.cn/mbloghead/baa37d8b771996f88cc8'),
    array("name"=>'Jeep_cherokee',"nick"=>'烛光','head'=>'http://app.qlogo.cn/mbloghead/2625cf542fd057b5543a'),
    array("name"=>'lihaipen_4303',"nick"=>'淡淡的微笑','head'=>'http://app.qlogo.cn/mbloghead/bd63b6efc87e561910f2'),
    array("name"=>'msfang',"nick"=>'智慧语录','head'=>'http://app.qlogo.cn/mbloghead/7e51a555de0b7014f368'),
    array("name"=>'guoshanhui',"nick"=>'每日精彩语录','head'=>'http://app.qlogo.cn/mbloghead/21c7d23a119cf7266b0c'),
    array("name"=>'hb0803461',"nick"=>'开心','head'=>'http://app.qlogo.cn/mbloghead/12bcac6136438515ac38'),
    );
    $userstr="";
    foreach ($userlist2 as $user)
	{
	  $userstr.="<li><p><a href=\"index.php?m=guest&u=".$user["name"]."\"><img src=\"".$user["head"]."/50\"></a><p><h3><a href=\"index.php?m=guest&u=".$user["name"]."\">".$user["nick"]."</a></h3></li>";
	}
	echo"<ul class=\"userlist\">".$userstr."</ul>";
    ?>
<div class="sp7"></div>-->
<div class="lbj15 w244 h23"><div class="sp4"></div>
    <div class="fl ml39 f12 fb">公告</div></div>
    <div class="sp4"></div>
    <div class="mr10 ml33">
<?php
$link="index.php?id=";
$BulletinList = MBGlobal::getAdminRecomm()->showBulletin(0, 10, 1);
$gonggaostr="";
if($BulletinList["list"])
{foreach ($BulletinList["list"] as $g)
{$gonggaostr.="<li><a href=\"".$link.$g["id"]."\" target=\"_blank\" class=\"llink5\">".$g["text"]."</a></li>";}
}
?>
<ul class="marh l21 f12 fl" style=" color:#8A8B8D;"><?php echo($gonggaostr);?></ul>
</div>
<div class="sp7"></div>
<div class="lbj15 w244 h23"><div class="sp4"></div>
    <div class="fl ml39 f12 fb">热门话题</div></div>
    <div class="sp4"></div>
    <div class="ship fl ml14 mr2">
<?php
$hothtstr="";
$link="index.php?m=topic&k=";
if($hotTopics){
foreach ($hotTopics as $h)
{
  $hothtstr.="<li>　　<a href=\"".$link.urlencode($h["text"])."\" target=\"_blank\" class=\"llink5\">".$h["text"]."</a>".(array_key_exists("tweetnum",$h)?"(".$h["tweetnum"].")":"")."</li>";
}
echo"<ul>".$hothtstr."</ul>";
}
?>
</div>
<div class="sp7"></div>
<table width="220" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="top" width="20"><div class="f1"><img src="style/images/login/lbj31.jpg" width="20" height="33" alt="" /></div></td>
    <td align="center" valign="top" width="200">
    <div class="fl l24 ml5">你可以用手机登陆南海网微博<br />
手机登陆地址：http://t.hinews.cn<br />
<a href="#" target="_blank" class="llink5">详细&gt;&gt;</a></div>
    
    </td>
  </tr>
</table>

    
    
    </td>
  </tr>
</table>


</div><div class="lbj16 w950 h35">
<div class="sp12"></div>
<div class="fl ml18 f14 llink0001"><a href="#" target="_blank" class="llink0001">南海网首页</a>　<a href="#" target="_blank" class="llink0001">阳光岛社区</a>　<a href="#" target="_blank" class="llink0001">阳光家园</a>　<a href="#" target="_blank" class="llink0001">阳光相册</a>　<a href="#" target="_blank" class="llink0001">博客岛</a>　<a href="#" target="_blank" class="llink0001">网友写新闻</a></div>

</div>
<div class="sp18"></div>
<div class="f12" style="color:#3096d0;">海南日报报业集团南海网   版权所有　2011-2020   微博服务热线：0898-66810302　 传真：0898-66810545   地址：海南省海口市金盘路30号新闻大厦9楼</div>
<div class="sp18"></div>
</div>
</div>



</center>
</body>
</html>
